frmVBArray Thunking with Huge VB Arrays Form2 txAnswer txOffset cmdSumArray Sum the Array txVBUT txVBLinear txVBHandle cmdMakeArray Rebuild VB Array (ReDim) txValElemt txNumElemts Label11 And VB can still use it. Label10 $VB Allocates Memory, Win32s uses it! Label8 Put your 32 bit Function Here! MS Sans Serif Label9 (Do First) Label7 Answer Label6 +Offset between W3.1 and Win32 linear Spaces Label5 Win32s Linear Address Label4 Win 3.1 Linear Address Label3 VBArray Memory Handle Label2 Value of Each Element Label1 Number of Array Elements Line1 Form_Loadf Label1_Click Text1_Change NumberElements Text1C TextS bigArray Command1_Click^ MakeArray_Click Text2_Change2 NumElemts_Change NumElements ValElement- NumElemtsv TxBoxValElemts_ChangeT txBoxValElemts txBoxNumElemtsV Label2_Click TxBoxNumElemts_Change; Form_Click( MB_OK MB_OKCANCELh MB_YESNOCANCEL MB_YESNO MB_ICONSTOP MB_ICONQUESTION MB_ICONEXCLAMATION MB_ICONINFORMATIONA MB_DEFBUTTON2 IDYES DgDef Response Title have_ machiney elsIf ColumnsB h0ffff Leftover ArrSize ArrayRows ArraySize8 ArrColumns ArrRows lpVBArrayw VBPTRtoLong Numbersp VBSel lhvbarray GlobalHandle hVBArray VBLowWord GlobalFix GetSelectorBase UTSelectorOffSetToLinear Win31Linear WIN32LinearJ OffSet GlobalUnFix Text2 text3> VBLinearAddress| linearaddress Text5 UTAddressM VBUTAddress< Text6 Text7L dwgetAddressForInteger dwgetAddressForLong) sVBArray dwDWORDto2Integers jlpVBArray jVBSelT jlhvbarray jhVBArray sVBArray2> OutLoop ArratRows IfOffSet. text34 text4` Label5_Click Win16Start SumArray CndSumArray_Clicku Win16Finish SumArray32 Sum2K trxt[ Win32Start Win32Finish Label10_Click ThenVBLinearAddress LockArray firstElement fills memory blocks txVBHandle. txVBLinearz txVBUT txOffset txNumElemts_Change txNumElemts txValElemts_Change txValElemts Text5_Change cmdSumArray_Click txValElemt_Change: txValElemt cmdMakeArray_Click txAnswer txBoxValElemti arraycreated MessageBox OutofMem Leavesub frmVBArray timer01 array unload: cmdMakeArray_Click this sub redimensions and fills a VB array then gets array linear addresses The array you requested is more than 15 MB, forget it You must have a lot of memory! This array is between 1 and 15 MB Make Big VB Array? turns off error handling fills array with value if overs 64000 bytes,r fills memory in 16,000 byte blocks This is the key code:fixing linear virtual address of VB array must get pointer to first elemento get selector from pointer get handle from selector handle is in the low wordl fix VB array in virtual space Win 3.1 function to get Windows3.1 linear address. UT function to get WIn32s linear address from pointeri must unfix VB Array must convert long to equivalent of dword (unsigned long int) and correct for offset of first element from selector start VB arrays do not start at the selectorse large (huge) arrays are offset an additional two bytes same conversion for >2GB virtual addresses long to unsigned long int (equivalent) conversion for Win32s address compare Win32s address with Win3.1 Out of memory, reduce size of array Array too big undefined error cmdSumArray_Click summming the array in a win32 function from VB Redim Array first get pointer to first element get selector from pointers calling 32 bit function through UT Form_Load txNumElemts_Change enter a number >0 Array size txValElemt_Change